<template>
 <div class="detail">
   <div v-for="gift in giftDetail">
   <img :src="gift.game_picbanner"  class="banner" />
   <div class="code-box">
     <h2>您的游戏兑换码为</h2>
     <p class="code" v-if="gift.card_num!=''">{{gift.card_num}}</p>
     <p  class="code" v-else>已过期</p>
     <p class="tip">温馨提示：框内长按可拷贝游戏码</p>
   </div>
   <h1 class="h-title">礼包说明</h1>
   <div class="intr">
     <div class="row">
       <h4>【有效时间】</h4>
       <p>{{gift.type_date}} 至 {{gift.type_die_time}} </p>
     </div>
     <div class="row">
      <h4>【礼包描述】</h4>
      <p>{{gift.gift_direction}}</p>
    </div>
     <div class="row">
       <h4>【礼包内容】</h4>
       <p>{{gift.gift_content}}</p>
     </div>
   </div>
  </div>
 </div>
</template>
<script>
  export  default {
    data(){
      return{
        giftDetail:[]
      }
    },
    mounted:function () {
      this.getGiftDetail();
    },
    methods:{
      getGiftDetail:function () {
        console.log(this.giftDetail.length);
        var  id = this.$route.query.id ;
        this.$jsonp("http://api.65.com/65api/all_cast_list.php?action=card_list&page=1&end=5&game_name=&type_id="+id,null,(err,data)=>{
          if(data.code=='1'){
            this.giftDetail = data.card_list;
          }else{
            alert(data.msg);
          }

        })
      }
    }
  }
</script>


